﻿using ArtMath.Flag;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace ArtMath.Window
{
    public partial class AboutWindow : Form
    {
        public AboutWindow()
        {
            InitializeComponent();
            try
            {
                WebClient wc = new WebClient();
                string path = Path.Combine(Flags.TempPath, Flags.SoftwareName + ".about.txt");
                wc.DownloadFile(Flags.OfficialWebsite + "/" + Flags.SoftwareName + "/about." + (Thread.CurrentThread.CurrentUICulture.Name == "zh-CN" ? "zh-CN" : "en-US") + ".txt", path);
                textBox1.Text = File.ReadAllText(path, Encoding.UTF8).Replace("\n", Environment.NewLine);
                File.Delete(path);
                label1.Visible = false;
            }
            catch (Exception ex)
            {
                textBox1.Text = ex.Message;
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }
    }
}
